/* CreateDownLoadExcelProcessor.java
 *
 * Project/Product: GW
 *
 * Modify Information:
 * =============================================================================
 *   Author	Date       Description
 *   ----------	---------- ---------------------------------------------------
 *   Jackey	2008-2-21	First release
 *
 * Licensed Materials - Property of APEP
 * =============================================================================
 *    (C) COPYRIGHT Shanghai Auto Mart E-Procurement Co., Ltd. 2007 - 2008
 *    All Rights Reserved.
 *
 *    This software is the confidential and proprietary information of
 *    Shanghai Auto Mart E-Procurement Co., Ltd. ("Confidential Information").
 *    You shall not disclose such Confidential Information and shall use it only
 *    in accordance with the terms of the license agreement you entered into 
 *    with Shanghai Auto Mart E-Procurement Co., Ltd.
 *
 * Noties:
 * =============================================================================
 * 
 */

package system.imp;

import system.base.*;

import framework.core.*;

public class CreateDownLoadExcelProcessor {
    
    /**
     * 创建要下载的Excel文件
     * @param loginContext
     * @param tableName
     * @param warehouseCode
     * @param type
     * @param lastupdatetime
     * @return 生成文件服务器端路径
     *         错误返回:ConstDefine.EXCELFILE_CREATE_ERROR
     */
    public static String createDownLoadExcelByDB(String serverPath,String tableName,String type,String warehouseCode,String lastupdatetime)
    {
        String strFilePath = "";
        DBConnection con = null;
        try{
            con = DBConnection.open(false);
            con.setAutoCommit(false);            
            strFilePath = CreateExcelFileByDB.createExcelFilePath(con,serverPath, tableName, warehouseCode, type, lastupdatetime);
            con.commit();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            try{
                System.out.println("createDownLoadExcelByDB:" + e.getMessage());
                con.rollback();
            }
            catch(Exception e1)
            {
                
            }
            strFilePath = ConstDefine.EXCELFILE_CREATE_ERROR;
        }finally
        {
            try{
                if (con != null)
                    con.close();
            }catch(Exception e)
            {
                
            }
        }
        
        return strFilePath;
    }
}
